<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{% $title %}</title>
<script language="javascript" type="text/javascript"
	src="js/default/jquery-1.9.1.min.js"> </script>
<script language="javascript" type="text/javascript"
	src="js/default/md5.js"> </script>	
<script language="javascript" type="text/javascript">
$=jQuery;
$(document).ready(function(){
	$("#pre_password_error").hide();
	$("#pwd_not_equal").hide();
	$("#email_error").hide();
	});
function checkPrePassword(){
	if($("#admin_name").val()!=""){
	 send_url="pre_password_check.php";
	 pre_password=hex_md5($("#pre_password").val());
	 $.get(send_url,{pre_password:pre_password,timestamp:new Date().getTime()},function(data){
		 if(data!=""){
		 $("#pre_password_error").show();
		 $("#pre_password_error").val(data);
		 }
		 else{
			 $("#pre_password_error").val("");
			 $("#pre_password_error").hide();
		 }
	 });
	}
}
function checkPassword(){
	if($("#pwd").val()==""||$("#pwd_check").val()==""){
		 $("#pwd_not_equal").val("");
		 $("#pwd_not_equal").hide();
	
		return;
	}
	  if($("#pwd_check").val()!=$("#pwd").val()){
		 $("#pwd_not_equal").show();
		 $("#pwd_not_equal").val("两次密码输入不相同，请检查！");
		 }
		 else{
			 $("#pwd_not_equal").val("");
			 $("#pwd_not_equal").hide();
		 }
}
function checkEmail(){
	 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	  var email=$("#email").val();
	 if((email!="")&&(!myreg.test(email))){
		 $("#email_error").show();
		 $("#email_error").val("请输入正确的邮箱地址！");
		 }
		 else{
			 $("#email_error").val("");
			 $("#email_error").hide();
		 }
	  
}

function checkSubmit(){
	
	if($("#pre_password").val()==""){
		alert("请输入原密码！");
		return false;
	}
	if($("#pre_password_error").val()!=""){
		alert("请修改不正确的原密码！");
		return false;
	}
	if($("#pwd_not_equal").val()!=""){
		alert("请修改不一置的密码！");
		return false;
	}

	if($("#email_error").val()!=""){
		alert("请修改不正确的邮箱地址！");
		return false;
	}
	if($("#pwd").val()!=""){
	$("#pwd").val(hex_md5($("#pwd").val()));
	}
}
</script>
<style>
/*主体*/
html,body {
	width: 100%;
	height: 100%;
	font-family: "微软雅黑";
	font-size: 13px;
	margin:0px;
}

#main {
    padding-left:20px;
    padding-top:1px;
	border: 1px double #aaa;
}

.division {
	border: 1px dotted #aaa;
}
a{
   text-decoration: none;
}
div{
 background:#EEFFEE;
}
#pre_password_error,#pwd_not_equal,#email_error{
 color: red;
}
.readonly{
  border:0;
  background:#EEFFEE;
}
.hidden_text{
visibility: hidden;
}
#submit{
 padding-top:5px;
  padding-bottom:5px; 
  margin-left:100px;
}
</style>
</head>
<body>
	<div id="main">
		<form action="admin_modify_byself_save.php" method="post" id="forms" onSubmit="return checkSubmit()">
		<input type="hidden" name="id" value="{% $admin_id %}">
		<span><img alt="必填" title="必填" src="images/admin/flag.png" width="10px" height="10px">&nbsp;原密码：</span> <input id="pre_password" name="pre_password" type="password"
				size="20"  value="" onchange="checkPrePassword();"/>
				<input id="pre_password_error" value="" readonly="readonly" class="readonly" size="30"/>
				<div class="division"></div>
				<input id="admin_name" name="admin_name" type="hidden"
				size="20"  value="{% $admin_name %}" readonly="readonly" class="readonly"/>
			<span>
			<span class="hidden_text">占</span>新密码：</span> <input name="pwd" id="pwd" type="password"
				size="20" onchange="checkPassword();"/>[注：留空则不修改]
			<div class="division"></div>
			<span>
			确认密码：</span> <input name="pwd_check" id="pwd_check" type="password"
				size="20" onchange="checkPassword();"/><input id="pwd_not_equal" value="" readonly="readonly" class="readonly" size="50"/>
			<div class="division"></div>
			<span>真实姓名：</span> <input name="admin_true_name" id="admin_true_name" value="{% $admin_true_name %}" type="text"
				size="20"/>
				<div class="division"></div>
			<span>邮箱地址：</span> <input name="email" id="email"  value="{% $email %}" type="text"
				size="20" onchange="checkEmail();"/><input id="email_error" value="" readonly="readonly" class="readonly" size="50"/>
				<div class="division"></div>
			
			 <div align="left" id="submit"><input type="submit" title="保存" name="submit" value="保存" /></div>
		   
		</form>
	</div>
</body>
</html>